Skip to content

Guard pip updates against in-place migration to the split layout - #10015

Open
cocolord wants to merge 3 commits into
loopx-project:mainfrom
cocolord:codex/guard-pip-split-upgrade-20261203
Open

cocolord wants to merge 3 commits into
loopx-project:mainfrom
cocolord:codex/guard-pip-split-upgrade-20261203

Conversation

@cocolord

@cocolord cocolord commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Problem

A pip-backed monolithic LoopX installation can resolve a dependency-only split metapackage during loopx update apply. pip installs the split dependencies before removing the old monolith, whose RECORD still claims overlapping launcher and runtime files.

Change

  • Resolve the target before pip writes to the installation. Refuse in-place adoption of the split layout and return the existing separate-environment migration and rollback guidance.
  • Pin an accepted monolithic artifact by URL and SHA-256. Preserve the existing pip dependency handling and post-install readback.
  • Preserve a refusal in the terminal update receipt when prompt reconciliation sees that package installation never started.

Verification

  • Exact-source installed-wheel test exercised loopx update apply after pip resolved a dependency-only split fixture. The refusal survived the detached operation, all 2,275 audited installed files retained their bytes, and the installed CLI remained usable.
  • A real pip test installed the verified monolith after a newer split target appeared and rejected replacement bytes under the same version.
  • Exact-source quick premerge passed. Local lifecycle tests passed 170 cases with three platform skips, and 20 focused operation tests passed. Installed-wheel and quick premerge run

The already released updater still relies on the stable publication guard and the isolated migration path during the split rollout. This proposal covers the pip-owned installation path.

Native Windows follow-up

The exact head ba5f59cc41 passed installed qualification on Windows x64 with Python 3.11.9 and pip 25.1.1.

  • The released 2.4.1 control resolved a local split fixture. pip exited successfully, then the launcher and the overlapping Core file were missing. A separate 2.4.1 environment read the original SQLite Todo.
  • The installed console preserved the existing Windows launcher protection and gave the owning Python command. Through that entry point, this change refused the selected split target before installation, preserved the terminal operation receipt, and left all 2,275 audited files and the original Todo intact.
  • A real pip run installed a verified monolithic fixture from a Windows file URL containing spaces. It rejected different bytes at the same URL and version. Four source cases passed. Native Windows qualification

Review follow-up

Revision ff6ebe7849 against main@0e784d7cba. The six-file patch is unchanged against current main. The focused source suites passed 223 cases with three platform skips. A real pip interpreter refused the split fixture without changing the installed monolith, used the pinned wheel even after a newer split fixture appeared, and refused different bytes offered under the same URL and version. Source install, packaged-archive install, and update smokes passed after preparing the verified Chat bundle before packaging. The native Windows verification above was recorded on the earlier revision of the same patch.

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

在原 pip 环境执行 LoopX 更新、可以先在独立环境试迁移的现有用户。 主干直接运行 pip install --upgrade loopx。若索引选中依赖型 split 包,pip 将先处理其组件,而旧 monolith 仍持有交叠文件的 RECORD。 真实 pip 先解析候选;若是 split 就原地拒绝。通过的同布局产物用 URL 和 SHA-256 固定,仍走现有安装后检验。 安装现有单包后,本地包仓让 pip 解析到仅依赖 loopx-core 的新发布。 有界改变现有 pip 更新下的布局选择与回执,保留包管理器和原安装的回退方式。

改动思路 / Approach

复用原 Python 包管理器命令、安装世代读回和更新回执。有界改变现有 pip 更新下的布局选择与回执,保留包管理器和原安装的回退方式。 将 preflight 放在现有安装边界,使用原安装器同一命令和来源解析,再复用原验证与退出状态。 检查 pip report 的规范包名及依赖;拒绝 split;已解析的新单包按 artifact hash 封闭。

具体改动 / Changes

  • 真实解析 通过原 pip 命令的 dry run 得到依赖和实际下载物。split 元数据或 Core 依赖使执行留在更新前,回复中提供迁移路径。
  • 固定可应用目标 将已通过的同布局目标固定到 artifact URL 和摘要。索引晚到的 split 版本不会重选,新字节也须满足原 digest。
  • 执行器分流 复用原包管理器和已安装 package identity 的读回。没有安装动作的拒绝直接退出执行。
  • 后台状态 允许 execution 为空,保留原错误和进程终态。旧环境可继续使用,并能按独立环境路径迁移。

基线 dc0505e 的 安装所有者 与 安装后读回 对应 保留安装所有权 和 终态明确可读与回退。

对主干的风险 / Risks

从本提交构建 wheel,安装到隔离环境,再由真实 pip 解析本地 split 元包。已安装的 update apply 拒绝,终态 status 保留原因,2275 个包拥有文件字节一致,原 CLI 可用。 真实 pip 同布局对照中,解析后出现更高版本 split 时仍安装已核验的 3.0.0 单包。已核验 wheel 的同版本字节被替换时 hash 校验失败并保留 2.4.1。 pipx 与 archive 不进入这个 preflight。原安装后验证仍由原执行器处理;同布局真实 pip 可以成功更新。 223 项定向 Python 测试通过,3 项平台用例跳过。Quick premerge 的 6 项直接和 3 项选定检查通过。 独立验证使用 macOS、离线 wheel 和临时安装。Windows、真实外部私有索引和稳定渠道 rollout 未在本轮复验。 当前主干 ca020c4 三方组合干净。

我的整体评价 / Verdict

批准这个 pip 更新边界。真实安装拒绝在原环境采用 split,原文件和 CLI 仍可继续使用。同布局升级及产物校验失败的路径也在隔离安装器中验证。

英文简短结论

English verdict: APPROVE at ba5f59c. An installed wheel refuses the split metapackage before changing any owned files. A real pip run keeps the verified monolith when a newer split appears and rejects replacement bytes under the same version.

…lidate-10015-pip-update-current-main-20261204

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants